package com.example.springboot.controller.zhAndEnReturnConvert;

import com.example.springboot.pojo.CodeEnum;
import com.example.springboot.pojo.ResultData;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * controller测试
 *
 * @Author:ChenZhangKun
 * @Date: 2021/7/25 15:46
 */
@RestController
@RequestMapping("/zh/en")
public class ConvertResultController {
    @GetMapping("test")
    public ResultData test(@RequestParam int testNum) {
        if (1 == testNum) {
            return ResultData.success(CodeEnum.SUCCESS);
        }
        if (2 == testNum) {
            return ResultData.success(CodeEnum.FAIL);
        }
        if (3 == testNum) {
            return ResultData.success("自定义的返回语");
        }
        return ResultData.success(CodeEnum.SUCCESS);
    }
}
